
<template>
  <div class="container-fluid page-body-wrapper">
    <nav class="sidebar sidebar-offcanvas" id="sidebar">
      <ul class="list-group">
        <li class="list-group-item" @click="getMatchCmds(item)" v-for="(item,index) in tags" :key="index">{{item.title}}</li>
      </ul>
    </nav>
    <div class="main-panel">
      <div class="content-wrapper">
        <router-view></router-view>
      </div>
      <!-- <footer class="footer">
        <div class="d-sm-flex justify-content-center justify-content-sm-between">
          <span
            class="text-muted d-block text-center text-sm-left d-sm-inline-block"
          >Copyright © bootstrapdash.com 2024</span>
          <span class="float-none float-sm-right d-block mt-1 mt-sm-0 text-center">李文杰创作</span>
        </div>
      </footer> -->
    </div>
  </div>
</template>
<script>
import { mapGetters } from "vuex";
import {getMatchCmds} from '@/utils/cmd'
import {getTags} from '@/utils/tag'
export default {
  name: "",
  components: {},
  data() {
    return {
      
    };
  },
  created() {
    this.getTags()
  },
  mounted() {},
  methods: {
     async getTags() {
      let res = await getTags();
      console.log('tag res 666',res)
      this.$store.dispatch("app/setTags", res);
    },
    async getMatchCmds(tag){
      console.log('tag',tag);
      let res = await getMatchCmds({sortBy:'title',size:10,page:1},{tag:tag.value})
      console.log('res--',res)
      this.$store.dispatch("cmd/setCmds", res);
    }
  },
  computed: {
    ...mapGetters("cmd", ["cmds"]),
    ...mapGetters("app", ["tags"])
  }
};
</script>
<style scoped>
.page-body-wrapper {
  min-height: calc(100vh - 40px);
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: row;
  flex-direction: row;
  padding-left: 0;
  padding-right: 0;
  padding-top: 60px;
}
.sidebar {
  min-height: calc(100vh - 40px);
  background: #ffffff;
  font-family: "Roboto", sans-serif;
  font-weight: 400;
  padding: 0;
  width: 200px;
  z-index: 11;
  transition: width 0.25s ease, background 0.25s ease;
  box-shadow: none;
  border-right: 1px solid #e3e3e3;
  position: fixed;
  left: 0;
  top: 0;
  padding-top: 60px;
}
.main-panel {
  transition: width 0.25s ease, margin 0.25s ease;
  width: calc(100% - 200px);
  margin-left: 200px;
  min-height: calc(100vh - 60px);
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
  flex-direction: column;
}
.content-wrapper {
  background: #f3f3f3;
  padding: 2.1rem 1.04rem;
  width: 100%;
  -webkit-flex-grow: 1;
  flex-grow: 1;
}
.footer {
  background: #f3f3f3;
  padding: 30px 1rem;
  transition: all 0.25s ease;
  -moz-transition: all 0.25s ease;
  -webkit-transition: all 0.25s ease;
  -ms-transition: all 0.25s ease;
  font-size: calc(0.875rem - 0.05rem);
  font-family: "Roboto", sans-serif;
  font-weight: 400;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}
</style>
